Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R4R: Store Refactor 1 #2985

Merged
merged 36 commits into from
Feb 2, 2019
Merged

R4R: Store Refactor 1 #2985

merged 36 commits into from
Feb 2, 2019

Conversation

mossid
Copy link
Contributor

@mossid mossid commented Dec 3, 2018

  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added entries in PENDING.md with issue #

  • rereviewed Files changed in the github PR explorer

Addresses: #2986


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@mossid mossid added the wip label Dec 3, 2018
@mossid mossid changed the title Store Refactor 1 WIP: Store Refactor 1 Dec 3, 2018
@codecov
Copy link

codecov bot commented Dec 3, 2018

Codecov Report

Merging #2985 into develop will decrease coverage by 0.07%.
The diff coverage is 64.07%.

@@             Coverage Diff             @@
##           develop    #2985      +/-   ##
===========================================
- Coverage    59.39%   59.32%   -0.08%     
===========================================
  Files          135      130       -5     
  Lines         9979     9809     -170     
===========================================
- Hits          5927     5819     -108     
+ Misses        3680     3620      -60     
+ Partials       372      370       -2

@mossid mossid added core Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. labels Dec 3, 2018
@mossid mossid mentioned this pull request Dec 3, 2018
@mossid mossid force-pushed the joon/store-refactor-1 branch from 448c93a to 26e05ae Compare December 3, 2018 19:12
@mossid mossid changed the title WIP: Store Refactor 1 R4R: Store Refactor 1 Dec 3, 2018
@cwgoes cwgoes self-assigned this Dec 4, 2018
@jaekwon
Copy link
Contributor

jaekwon commented Dec 9, 2018

Will there be any logic changes in this PR? I hope not. Please hold off merging btw, I want to understand it, and need to plan ahead toward an KeyObjectStore wrapper for the KVStore.

@jaekwon jaekwon self-requested a review December 9, 2018 07:37
@mossid
Copy link
Contributor Author

mossid commented Dec 10, 2018

@jaekwon There is no, most of the changes are just %sing. The most significant changes will be the removal of KVStore.Prefix() and KVStore.Gas() which are replaced by direct New{Prefix, Gas}Store calling, and types/{store, gas}.go moved into store/types/.

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this package reorganization makes sense, lots of comments (some probably not introduced in this PR, but maybe we can fix them here...)

store/cachemulti/store.go Outdated Show resolved Hide resolved
store/firstlast.go Outdated Show resolved Hide resolved
store/iavl/wire.go Show resolved Hide resolved
)

// copied from iavl/store_test.go
var (
cacheSize = 100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should really be config parameters

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still true - could be a separate PR though.

store/queue/queue_test.go Outdated Show resolved Hide resolved
store/types/store.go Outdated Show resolved Hide resolved
store/types/store.go Outdated Show resolved Hide resolved
// Start must be less than end, or the Iterator is invalid.
// Iterator must be closed by caller.
// To iterate over entire domain, use store.Iterator(nil, nil)
// CONTRACT: No writes may happen within a domain while an iterator exists over it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw we don't obey this contract at all (assuming writes include deletions, but even so) - we break it all over the codebase

is this actually required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The iavl tree requires, but since we are cache wrapping the iavlstore before passing it to the handlers and the modification on the CacheKVStore is not reflected on the iterator, it looks safe to do it in the modules. It is still an exception but for the module writers' perspective we should update the comment to notify them that it is safe to modify in the modules

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasonable - let's definitely update the comment

// Iterator over a domain of keys in descending order. End is exclusive.
// Start must be less than end, or the Iterator is invalid.
// Iterator must be closed by caller.
// CONTRACT: No writes may happen within a domain while an iterator exists over it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above (we break the contract)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the comment here too.

store/types/store.go Outdated Show resolved Hide resolved
@jackzampolin
Copy link
Member

Would also be really nice to have a store/README.md that has brief (1 sentance is fine to start) descriptions of each of the different store impls and subpackages.

@cwgoes
Copy link
Contributor

cwgoes commented Jan 30, 2019

Needs linter fixes - and agreed with @jackzampolin.

Copy link
Contributor

@alessio alessio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat! Good to go from me.

Lint failures are unrelated, though I'm rerunning the build now.

@alessio alessio requested a review from jackzampolin January 30, 2019 18:51
@mossid mossid changed the title R4R: Store Refactor 1 : Store Refactor 1 Jan 30, 2019
@mossid mossid changed the title : Store Refactor 1 WIP: Store Refactor 1 Jan 30, 2019
@cwgoes
Copy link
Contributor

cwgoes commented Jan 30, 2019

@mossid Is this WIP again now - are we waiting on something?

@mossid
Copy link
Contributor Author

mossid commented Jan 30, 2019

Working on the README, some parts are being written @cwgoes

@mossid mossid changed the title WIP: Store Refactor 1 : Store Refactor 1 Jan 30, 2019
@mossid mossid changed the title : Store Refactor 1 R4R: Store Refactor 1 Jan 30, 2019
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few notes on README.md - otherwise LGTM.

store/README.md Outdated Show resolved Hide resolved
store/README.md Outdated Show resolved Hide resolved
store/README.md Outdated Show resolved Hide resolved
store/README.md Outdated Show resolved Hide resolved
store/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a fair amount of changes here, but most of which look reasonable and are headed in a great direction. Approving.

Copy link
Member

@jackzampolin jackzampolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A great start at getting the /store package organized and documented! Good work @mossid ! LGTM

@jackzampolin jackzampolin merged commit 08e62fb into develop Feb 2, 2019
@cwgoes cwgoes deleted the joon/store-refactor-1 branch March 4, 2019 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants